﻿HmJS.$Import('log');
HmJS.$Import('core.element.event');
//HmJS.$Import('core.domready');
HmJS.$Import('util.FunctionStack');

HmJS.register('demo.module.util.functionstack', function ($ns) {
	var that = {};

	that.todo = function () {
		var stack = new $ns.util.FunctionStack(
				function (a) {
					$('res').set('html', a);
				},

				function (a) {
					$('res').set('html', 'b' + a);
				}
			);

		stack.push(
				function (a) {
					$('res').set('html', 'c' + a);
				},

				function (a) {
					$('res').set('html', 'd' + a);
				},

				function (a) {
					$('res').set('html', 'e' + a);
				}
			);

		$('step').addEvent('click', function () {
			stack.step('avd')
		});
		$('start').addEvent('click', function () {
			stack.play(700, ['bvc'])
		});
		$('pause').addEvent('click', function () {
			stack.pause()
		});
		$('stop').addEvent('click', function () {
			stack.stop()
		});
	};

	return that;
});
